<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>支付成功</title>
    <script type="text/javascript" charset="UTF-8"
            src="https://wx.gtimg.com/pay_h5/goldplan/js/jgoldplan-1.0.0.js"></script>
</head>

<body>
<!--wrap-->
<div class="wrap"  style='text-align:center;margin:0;padding:0;'>

    <!--invbgd-->
    <div class="invbgd flexcenter" style='text-align:center;margin:0;padding:0;'>
        <p class="titd">支付成功<span id="payMoney"></span></p>
    </div>
    <!--./invbgd-->
    <!--invbtnd-->
	<div style="margin: 5px;">
                <img src="" height="200" width="100%" id='image'>
            </div>
    <button type="button" class="btn-primary" id="tojumpbtn" style="margin:0 auto;border:none;background-color:#FFF;color:red;font-size:16px;">进店逛逛领红包 >></button>
    <!--./invbtnd-->
</div>
<!--./wrap-->
<input type="hidden" id="punitId" value=""/>
</body>
<script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
<script>
    window.onload = function () {
        var mchData = {action: 'onIframeReady', displayStyle: 'SHOW_CUSTOM_PAGE'};
        var postData = JSON.stringify(mchData);
        window.parent.postMessage(postData, 'https://payapp.weixin.qq.com')
    };
    document.getElementById("tojumpbtn").onclick = function () {
	var aaa = $("#punitId").val();
        var mchData = {
            action: 'jumpOut',
            jumpOutUrl: "https://csdl.jintianjifen.cn/admin/test/test2?"+aaa // 外跳链接
        };
        var postData = JSON.stringify(mchData);
        parent.postMessage(postData, 'https://payapp.weixin.qq.com');
    };
    initData();
    function initData () {
        var out_trade_no = getQueryString("out_trade_no");
        $.ajax({
            url: "/admin/Test/testtest",
            type: 'post',
            data: {
                out_trade_no: out_trade_no
            },
            dataType: 'JSON',
            success: function (returndata) {
                $("#punitId").val(returndata.msg);
                $("#image").attr('src',returndata.image);
                $("#payMoney").text('￥' + returndata.money);
            }
        })
    }
	function getQueryString(name) {
            var query = window.location.search.substring(1);
            var vars = query.split("&");
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split("=");
                if (pair[0] == name) {
                    return pair[1];
                }
            }
            return null;
        };
</script>
</html>